<?
$PageTitle=$msg["Page_News"];

include "div_menu.php";

try 
{
  db_call();
  $all_news = db_read_news(0, 10);

  print "<div class=\"news\">\n";
  print "<div class=\"list_in\">\n";

  if ($user["admin"]) {
    print "<div class=\"add_div\">";
    print "<a href=\"newsadd\">{$msg["Add"]}</a>";
    print "</div>\n";
  }

  $n = count($all_news);
  if ($n == 0)
  {
    echo $msg["NoNews"], "<br>";
    echo "<br>";
  }

  for ($i = 0; $i < $n; $i++) 
  {
    if ($i <> 0)
    {
       print "<div class=\"list_space\"></div>\n";
    }

    print "<div class=\"topic\">\n";
    print "<div class=\"topic_in\">\n";

    print "<div class=\"topic_in2\">\n";
    $news = $all_news[$i];
    print_news($news);
    print "</div>\n";

    if ($user["admin"]) 
    {
      echo '<div class="edit_div">';
      echo '<a href="newsedit?id=', $news["id"], '">', $msg["Edit"], '</a>', '&nbsp;&nbsp;';
      echo '<a href="newsdelete?id=', $news["id"], '">', $msg["Delete"], '</a>';
      echo "</div>\n";
    }

    print "</div>\n";
    print "</div>\n";
  }

  print "</div>\n";
  print "</div>\n";
} 
catch (Exception $e) 
{
  print_errors(array($e->getMessage()));
}


?>
